<template>
  <div id="app" >
    <el-container>
      <el-header height="150px">
        <div style="width:1080px;height:100px; margin: 0 auto;position: relative">
          <div style="float: left"><img src="@/assets/imgs/logo.png"
                                        style="width: 400px;height:100px;vertical-align: middle" alt=""></div>

          <div style="float: right;font-size: 15px;
          position: relative;right: 30px;text-align: right;
          padding-bottom: 10px;margin-top: 20px">
            <h2 >欢迎xxx回来</h2>
            <h3 ><a href="">购物车</a><el-divider direction="vertical"></el-divider>
            <a href="">我的账户</a><el-divider direction="vertical"></el-divider>
            <a href="/reg.html">新用户注册</a><el-divider direction="vertical"></el-divider>
            <a href="/newLogin.html">我要登录</a><el-divider direction="vertical"></el-divider>
            <a href="">帮助中心</a>
              </h3>
          </div>
        </div>
        <!--导航菜单开始-->
        <div>
          <el-menu style="background-color: #f3f0b5;width: 1050px;height: 55px"
                   :default-active="activeIndex"
                   class="el-menu-demo" mode="horizontal"
                   @select="handleSelect"
                   active-text-color="#fff">
            <el-menu-item style="color:black;font-weight: bold;font-size: 18px"
                          v-for="c in categoryArr" :index="c.id">
              <a href="/bookList"> {{c.categoryName}}</a></el-menu-item>


            <div style="float: right;position: relative;top: 9px;margin-right: 10px">
              <el-input  placeholder="请输入搜索内容" >
                <el-button slot="append" icon="el-icon-search" @click="search()"></el-button>
              </el-input>
            </div>
          </el-menu>
        </div>

      </el-header>
      <el-main>
        <router-view/>
      </el-main>
      <el-footer>
        <img style="width: 100%;height: 50px" src="@/assets/imgs/foot.jpg" alt="">
        <div style="background-color: #3f3f3f;padding:30px 0;text-align: center;color: #b1b1b1">
          <p>Copyright @ 重庆互联网学院 重庆市渝北区华山南路  JSD2207
          </p>
          <p>达内在线WWW.TMOOC.CN 专注于IT职业技能培训</p>
          <p>涵盖20余门课程体系，致力于打造权威的IT职业教育学习平台</p>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>
<script>

export default {
  data() {
    return{
      activeIndex: '1',
      categoryArr:[],
      topArr:[{title:"小米电视",saleCount:688},
        {title:"华为手机",saleCount:322},
        {title:"匹克球鞋",saleCount:256},
        {title:"联想电脑",saleCount:198}]
    }
  },
  methods:{
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    search(){
    },
    loadCategoryList(){
      let url='http://localhost:8080/categories';
      console.log('url='+url);
      this.axios.get(url).then((response)=>{
        let responseBody=response.data;
        if (responseBody.state==20000){
          this.categoryArr=responseBody.data;
          console.log(this.categoryArr);
        }else {
          this.$message.error(responseBody.message)
        }
      });
    }
  },
  mounted() {
    this.loadCategoryList();
  }
}
</script>

<style>
#app{
  width: 1080px !important;
  margin: 0 auto !important;
}
a{
  font-size: 20px;
  text-decoration: none;
  color: black;
}
.el-divider--horizontal {
  display: block;
  height: 1px;
  width: 100%;
  margin: 0;
}
.el-table .el-table__cell {
  padding: 0;
  min-width: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  text-overflow: ellipsis;
  vertical-align: middle;
  position: relative;
  text-align: left;
}
.notice{
  float: left;
  margin-top: 10px;
  width: 500px;
  height: 220px;
  background-color: #f3f0b5;
  border-radius: 8px;
}
.notice>p{
  padding-left: 20px;
  padding-right: 10px;
  font-size: 14px;
}
.hottitle{
  background-color:#f3f0b5 ;
  border-radius: 8px;
  margin-top: 10px;
  margin-left: 20px;
  float: left;
  width: 520px;
  height:220px ;
}
#b_r_div{
  margin-left: 30px;
  overflow: hidden;
  text-align: center;
}
#b_r_div>div{
  border: 1px solid #f3721c;
  width: 120px;
  height:170px;
  float: left;
  margin-left: 20px;
}
#b_r_div>div>.title_p2{
  margin-top: 5px;
  font-size: 12px;
  color: red;
  text-align: center;
  padding: 0;

}
#b_r_div>div>img{
  width: 120px;
  height: 140px;
  transition: all 0.6s;
}
#b_r_div>div>img:hover{
  transform: scale(1.1);
}

</style>
